from app.base.baseError import APIException


class Success(APIException):
    msg = "success"
    error_code = 200
    code = 200


class DeleteSuccess(APIException):
    msg = "delete success"
    error_code = -1
    code = 200


class ParameterException(APIException):
    msg = "校验错误"
    error_code = 1000
    code = 400


class ServerError(APIException):
    code = 500
    msg = '服务器繁忙，请重试!'
    error_code = 999


class RepeatData(APIException):
    code = 200
    error_code = 1009
    msg = '重复数据'


class NotFound(APIException):
    code = 404
    msg = '资源未找到'
    error_code = 1100


class AuthFailed(APIException):
    code = 401
    msg = '授权失败！'
    error_code = 1003


class ValueError(APIException):
    """
    数据库错误
    """
    code = 400
    error_code = 2000
    msg = '参数错误，请重试'


class RunScriptError(APIException):
    """
    脚本执行错误
    """
    code = 400
    error_code = 3000
    msg = '脚本执行出错'


class RequestError(APIException):
    """
    请求出错
    """
    code = 400
    error_code = 3100
    msg = '请求出错'
